<template>
  <div class="ConBox404" :style="bag">
      <div class="ConBox-Con">
          <h1>哎呀，你访问的页面不存在！ </h1>
          <p>你可以通过以下方式继续访问：</p>
          <ul class="clearfix">
              <li v-for="(item,index) in nav_lsit" :key="index"><a @click="goHome(index)">{{item.nav_name}}</a></li>
          </ul>
      </div>
  </div>
</template>

<script>
import urlimg from '@assets/images/error/404.jpg'
export default {
  name: 'Page404',
  computed: {

  },
  data () {
    return {
      bag: {
        backgroundImage: 'url(' + urlimg + ')',
        backgroundRepeat: 'no-repeat',
        backgroundSize: '100% 100%'
      },
      nav_lsit: [{
        nav_name: '返回首页'
      }, {
        nav_name: '返回上一页'
      }]
    }
  },
  methods: {
    goHome (index) {
      if (index === 0) {
        const Token = window.sessionStorage.getItem('token')
        console.log(Token)
        if (Token === null) {
          this.$router.push({
            path: '/login'
          })
        } else {
          this.$router.push({
            path: '/home'
          })
        }
      } else {
        this.$router.go(-1)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.ConBox404{
  width: 100%;
  height: 100vh;
}
.ConBox-Con {
  width: 682px;
  margin: 0 auto;
  padding-top: 150px;
}
.ConBox-Con  h1 {
  text-align: center;
  font-size: 50px;
  color: #999;
  font-weight: 400;
}
.ConBox-Con  p {
  font-size: 24px;
  color: #999;
  text-align: center;
  padding-top: 450px;
}
.ConBox-Con  ul {
  padding-top: 80px;
  width: 100%;
  display: flex;
  justify-content: center;
}
.ConBox-Con ul li {
  width: 155px;
  height: 55px;
  text-align: center;
  line-height: 55px;
  background: #fff;
  border-radius: 5px;
  display: inline-block;
  margin-left: 30px;
  -webkit-box-shadow: 0 12px 50px rgba(0,0,0,.1);
  box-shadow: 0 12px 50px rgba(0,0,0,.1);
}
.ConBox-Con ul li:first-child {
  margin-left: 0;
}
.ConBox-Con ul li:hover {
  background: #008ba4;
  color: #fff;
  cursor: pointer
}
</style>
